-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add documentation for Process.Kill(bool entireProcessTree) #2828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Here's what I've done:
Since the remarks were exactly the same as the other overload, I've moved them to be higher on the page and applicable to the whole page, not just the individual overloads. Let me know what you think!
I think it looks good. If @wtgodbe aggrees with the additional commits, then maybe we can get it merged. |
The reflection tool will undo your last change @carlossanlop from what I can tell 😉 |
@wtgodbe you can see how the changes would look like here: https://review.docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process.kill?view=netcore-3.0&branch=pr-en-us-2828 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a couple of suggestions and a comment, @wtgodbe.
xml/System.Diagnostics/Process.xml
Outdated
<summary>To be added.</summary> | ||
<remarks>To be added.</remarks> | ||
<param name="entireProcessTree"> | ||
<see langword="true" /> to kill the associated process and its descendants; <see langword="false" /> to kill only associated process.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<see langword="true" /> to kill the associated process and its descendants; <see langword="false" /> to kill only associated process.</param> | |
<see langword="true" /> to kill the associated process and its descendants; <see langword="false" /> to kill only the associated process.</param> |
xml/System.Diagnostics/Process.xml
Outdated
The `Kill` method forces a termination of the process, while <xref:System.Diagnostics.Process.CloseMainWindow%2A> only requests a termination. | ||
When a process with a graphical interface is executing, its message loop is in a wait state. | ||
The message loop executes every time a Windows message is sent to the process by the operating system. | ||
Calling <xref:System.Diagnostics.Process.CloseMainWindow%2A> sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling <xref:System.Diagnostics.Process.CloseMainWindow%2A> sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. | |
Calling <xref:System.Diagnostics.Process.CloseMainWindow%2A> sends a request to close the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. |
xml/System.Diagnostics/Process.xml
Outdated
|
||
-or- | ||
|
||
The associated process is a Win16 executable.</exception> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't this and line 2136 legacy conditions -- perhaps they should be deleted? (Are there still Win16 executables running on .NET Framework?)
Calling <xref:System.Diagnostics.Process.CloseMainWindow%2A> sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. | ||
The request to exit the process by calling <xref:System.Diagnostics.Process.CloseMainWindow%2A> does not force the application to quit. | ||
The application can ask for user verification before quitting, or it can refuse to quit. | ||
To force the application to quit, use the `Kill` method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To force the application to quit, use the `Kill` method. | |
To force the application to quit, use the `Kill` method. | |
Thanks for working on this, @wtgodbe! I added a couple change ideas as comments on code. |
@bgribaudo do you mean you backported the comments added here into the source code, or did you mean to add suggestions to this PR? |
Thanks for the feedback @rpetrusha, I've pushed a commit to address it. @bgribaudo I couldn't find your comments, could you point me towards them? |
Oops! I meant as comments on this change's Markdown code diff. Sorry for the confunsion. :-( |
|
||
> [!NOTE] | ||
> The <xref:System.Diagnostics.Process.Kill%2A> method executes asynchronously. | ||
> After calling the `Kill` method, call the <xref:System.Diagnostics.Process.WaitForExit%2A> method to wait for the process to exit, or check the <xref:System.Diagnostics.Process.HasExited%2A> property to determine if the process has exited. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make very clear that these ways of checking exit status only apply to the current process instance, maybe add something along the lines of the following?
"Note: WaitForExit()
and HasExited
do not reflect the status of descendant processes. When Kill(entireProcessTree: true)
is used, WaitForExit()
and HasExited
will indicate that exiting has completed after the given process exits, even if all descendants have not yet exited."
xml/System.Diagnostics/Process.xml
Outdated
<param name="entireProcessTree">To be added.</param> | ||
<summary>To be added.</summary> | ||
<param name="entireProcessTree"><see langword="true" /> to kill the associated process and its descendants; <see langword="false" /> to kill only the associated process.</param> | ||
<summary>Immediately stops the associated process, and optionally all of its child/descendent processes.</summary> | ||
<remarks>To be added.</remarks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Drop the word "all" above (from "optionally all of its child...") and note here that, when set to true
, processes where the call lacks permissions to view details will be silently skipped by the descendant termination process because the termination process is unable to determine whether those processes are descendants.
Maybe they didn't show up because I hadn't submitted the review (didn't realize that might be necessary :-(). Can you see them now? |
Now they appear @bgribaudo! |
@bgribaudo @carlossanlop @rpetrusha @mairaw PTAL at 61b1a6d |
The build failed. I've corrected the error, and a new build has started. |
@rpetrusha thanks for correcting the error, the build passed. This is fully baked and ready to get merged. |
Thanks for the additional changes, @wtgodbe. I'll merge your PR now. |
Thank you, @wtgodbe and team! |
Adds documentation for method System.Diagnostics.Process.Kill(bool entireProcessTree)
CC @krwq for area co-ownership, @bgribaudo who added this method, @carlossanlop for CoreFx documentation effort ownership, and @rpetrusha @mairaw for grammar concerns.